package com.hsylient.servlet;

import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.*;


@WebServlet(
        name = "helloServlet",
        value = "/hello-servlet",
        initParams = {
                @WebInitParam(name = "username", value = "hsylient"),
                @WebInitParam(name = "password", value = "123456")
        },
        loadOnStartup = 1,
        smallIcon = "小图标"
)
public class HelloServlet implements Servlet {

    private ServletConfig config;

    @Override
    public void init(ServletConfig config) throws ServletException {
        this.config = config;
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        System.out.println(config.getServletName());
        System.out.println(config.getServletContext());
        System.out.println(config.getInitParameter("username"));
        System.out.println(config.getInitParameter("password"));
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}